package com.hjw.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "alipay")
@Data
public class AlipayConfig {


    private boolean sandbox;
    private String appId;
    private String merchantPrivateKey;
    private String alipayPublicKey;
    private String notifyUrl;
    private String returnUrl;
    private String gatewayUrl;

    public AlipayConfig() {
        System.out.println("AlipayConfig........");
        System.out.println("appid==="+appId);
        System.out.println("私钥:"+merchantPrivateKey);
        System.out.println("公钥:"+alipayPublicKey);
    }

    public String getGatewayUrl() {

        return sandbox ? "https://openapi.alipaydev.com/gateway.do" : "https://openapi.alipay.com/gateway.do";
    }

    public void setGatewayUrl(String gatewayUrl) {
        this.gatewayUrl = gatewayUrl;
    }
}